import { FC } from 'react';
import { QuestionTitlePropsType, QuestionTitleDefaultProps } from './interface';
import { Typography } from 'antd';
const { Title } = Typography;
const QuestionTitle: FC<QuestionTitlePropsType> = (props: QuestionTitlePropsType) => {
  const { text = '', level = 1, isCenter = false } = { ...QuestionTitleDefaultProps, ...props };
  const getFontSize = (level: number) => {
    switch (level) {
      case 1:
        return '24px';
      case 2:
        return '20px';
      case 3:
        return '16px';
      default:
        return '16px';
    }
  };
  return (
    <Title
      style={{ textAlign: isCenter ? 'center' : 'start', fontSize: getFontSize(level) }}
      level={level}
    >
      {text}
    </Title>
  );
};

export default QuestionTitle;
